let contents = toml::Value::Table(toml).to_string();
try!(file.seek(SeekFrom::Start(0)));
try!(file.write_all(contents.as_bytes()));
+ try!(file.file().set_len(contents.len() as u64));
Ok(())
}
execs().with_status(0));
}
+#[test]
+fn login_with_differently_sized_token() {
+ // Verify that the configuration file gets properly trunchated.
+ let home = paths::home().join("new-home");
+ t!(fs::create_dir(&home));
+ assert_that(cargo_process().arg("login").arg("lmaolmaolmao").arg("-v"),
+ execs().with_status(0));
+ assert_that(cargo_process().arg("login").arg("lmao").arg("-v"),
+ execs().with_status(0));
+ assert_that(cargo_process().arg("login").arg("lmaolmaolmao").arg("-v"),
+ execs().with_status(0));
+}
+
#[test]
fn bad_license_file() {
Package::new("foo", "1.0.0").publish();